<?php
defined('BY_JYA') or exit('error');
/*
	编辑车辆信息
*/
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
if($_RQ['op']=='main'){
	if($_RQ['postdata']){
		$post=get_postdata();
		$update=array_fields(array('plate','engine_number','frame_number','brand','brandimg'),$post);
		if($update['plate']){
			$update['plate']=ijson_encode($update['plate']);
		}
		$this->update('member',$update,array('mid'=>$_SESSION['uid']));
		exi('设置成功！','','jy_move_agentcar/index/');
	}
	$member=$this->get('member',array('mid'=>$_SESSION['uid']),array('plate','engine_number','frame_number','brand','brandimg'));
	if($member['plate']){
		$member['plate']=json_decode($member['plate'],true);
	}else{
		$member['plate']=array('p'=>'京','c'=>'A');
	}
	//$member['brandimg']=$member['brandimg']?$this->plugin_resource.'images/brand/'.$member['brandimg']:$this->plugin_resource.'images/cardefault.png';
	$return['item']=$member;
	$return['plugin_resource']=$this->plugin_resource;

	$return['brands']=$this->car_brand();
	$return['active_brand']=$return['brands'][0]['childs'][0];
	exi($return);
}
